package com.ztp.lib.server;

import org.apache.ftpserver.ftplet.FtpRequest;
import org.apache.ftpserver.ftplet.FtpSession;
import static java.lang.System.out;

public class FtpUtils {
	public static void printSession(FtpSession session){
		out.println("***SESSION***");
		out.println("**FailedLogins "+ session.getFailedLogins());
		out.println("**Language "+ session.getLanguage());
		out.println("**MaxIdleTime "+ session.getMaxIdleTime());
		out.println("**UserArgument "+ session.getUserArgument());
		out.println("**ClientAddress "+ session.getClientAddress().getHostName() 
				+ " " +session.getClientAddress().getAddress().getHostAddress() 
				+ " " + session.getClientAddress().getPort());
		out.println("**ConnectionTime "+ session.getConnectionTime());
		out.println("**DataType "+ session.getDataType().toString());
		out.println("**LoginTime "+ session.getLoginTime());
		out.println("**SessionId "+ session.getSessionId().toString());
		out.println("**User "+ session.getUser().getName());
		out.println("**LoggedIn "+ session.isLoggedIn());
		out.println("**Secure "+ session.isSecure());
	}
	
	public static void printRequest(FtpRequest request){
		out.println("***FTP REQUEST***");
		out.println("Argument " 	+ request.getArgument());
		out.println("Command " 		+ request.getCommand());
		out.println("RequestLine " 	+ request.getRequestLine());
		out.println("hasArgument " 	+ request.hasArgument());
	}
}
